#ifndef __ADU_WATER_H__
#define __ADU_WATER_H__

#include "cocos2d.h"
#include "Spring.h"
#include <Box2D/Box2D.h>

USING_NS_CC;

class Water{
public:
    Water(int,float);
    ~Water();
    void OnUpdate(float);
    DrawNode* GetDrawer();
    void SetupColor(Color4F,Color4F);
    void Splash(float,int);

    void AddBody(b2Body* body);
	void RemoveBody(b2Body* body);
	void Clear();

private:
    float mVerticesSpacing;
    float mStartX;
    constexpr static const float mBottom = -10.0f;
    constexpr static const float mSpread = 0.25f;

    b2Vec2 mNormal;

    DrawNode* mDrawer;

    Vec2* mVertices;
    int mCount;

    Color4F mBoderColor;
    Color4F mFilledColor;

    Spring* mSpring;

    float mHeight;

    b2World* mWorld;

    b2BuoyancyControllerDef* mControllerDef;
    b2BuoyancyController* mController;

    b2Vec2 mStart;
};

#endif

